//
//  ResolveXML.m
//  takeout
//
//  Created by Mac on 12-2-18.
//  Copyright (c) 2012年 __MyCompanyName__. All rights reserved.
//

#import "ResolveXML.h"
#import "GDataXMLNode.h"
@implementation ResolveXML

//获得XML文件
-(GDataXMLDocument *)getXMLDocument:(NSString *)urlString{
    NSURL *url = [NSURL URLWithString:urlString];
    NSMutableURLRequest* request = [NSMutableURLRequest new];    
    [request setURL:url];    
    [request setHTTPMethod:@"GET"]; 
    NSHTTPURLResponse* response;    
    NSData* data = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:nil];  
    NSString* responseXMLResult=[[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
    NSError *error;
    GDataXMLDocument *doc = [[GDataXMLDocument alloc] initWithXMLString: responseXMLResult options:0 error:&error];
    [request release];
    [responseXMLResult release];
    return doc;
}
@end
